<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>反转任意数组</title>
		<script type="text/javascript">
			//反转任意数组
			function reserve(arr) {
				//定义一个空的数组来装反转之后的数值
				var arrNew = []
				//遍历数组
				for(var i = arr.length-1; i >= 0; i--) {
					arrNew[arrNew.length] = arr[i]
				}
				
				return arrNew;
			}
			var result = reserve([1,2,3,4,5])
			console.log(result)
		</script>
	</head>
	<body>
	</body>
</html>
